Quickstart
TPN is a decentralised VPN infrastructure provider. You can call the decentralised TPN endpoints to receive Wireguard config files that connect to a specific country for a given duration.
In these documentation you will learn how to call our endoints, and what to do with the config files you receive.
Tools and libraries
Cheatsheet
Please refer to the documentation in the sidebar for detailed information. For quick reference, you can use the example script below for inspiration.
- Bash
- JavaScript (Node.js)
- Python (requests)
#!/bin/bash
# View the available country codes
curl "http://185.189.44.166:3000/api/config/countries"
# Get a config file for any country for half a minute and save it to tpn_config.conf
curl "http://185.189.44.166:3000/api/config/new?format=text&geo=any&lease_minutes=.5" > tpn_config.conf
# Log out your IP address before connecting
curl icanhazip.com
# Connect to the VPN (requires sudo and WireGuard tools)
sudo wg-quick up ./tpn_config.conf
# Log out your IP address after connecting
curl icanhazip.com
# Disconnect the VPN
sudo wg-quick down ./tpn_config.conf
// Requires: npm install -S axios
import axios from 'axios';
import fs from 'fs';
import { execSync } from 'child_process';
// List countries
const countries = await axios.get('http://185.189.44.166:3000/api/config/countries');
console.log('Available countries:', countries.data);
// Fetch config
const config = await axios.get('http://185.189.44.166:3000/api/config/new?format=text&geo=any&lease_minutes=.5');
fs.writeFileSync('tpn_config.conf', config.data);
// Log IP before
const ipBefore = await axios.get('https://icanhazip.com');
console.log('IP before:', ipBefore.data.trim());
// Connect to VPN
execSync('sudo wg-quick up ./tpn_config.conf', { stdio: 'inherit' });
// Log IP after
const ipAfter = await axios.get('https://icanhazip.com');
console.log('IP after:', ipAfter.data.trim());
// Disconnect
execSync('sudo wg-quick down ./tpn_config.conf', { stdio: 'inherit' });
# Requires: requests
# pip install requests
import requests
import subprocess
# Get available country codes
resp = requests.get("http://185.189.44.166:3000/api/config/countries")
print("Available countries:", resp.text)
# Get config file
conf = requests.get("http://185.189.44.166:3000/api/config/new?format=text&geo=any&lease_minutes=.5")
with open("tpn_config.conf", "w") as f:
f.write(conf.text)
# IP before
ip_before = requests.get("https://icanhazip.com").text.strip()
print("IP before:", ip_before)
# Connect to VPN
subprocess.run(["sudo", "wg-quick", "up", "./tpn_config.conf"])
# IP after
ip_after = requests.get("https://icanhazip.com").text.strip()
print("IP after:", ip_after)
# Disconnect VPN
subprocess.run(["sudo", "wg-quick", "down", "./tpn_config.conf"])